﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EchoServer
{
    class Program
    {
        protected static readonly log4net.ILog log = log4net.LogManager.GetLogger("EchoServer");

        static void Initialize()
        {
            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo("EchoServer.log4net.xml"));
        }
        static void test()
        {
            System.Diagnostics.Process.Start("EchoClient.exe");
        }

        static void Main(string[] args)
        {
            Initialize();
            log.Info("-----------------------------------------------");

            ushort port = Convert.ToUInt16(System.Configuration.ConfigurationManager.AppSettings["port"]);
            WC.Pattern.Singleton<WC.Pilot.EchoServer>.Instance.Start(port);

            //test();

            Console.WriteLine("\nPress a key to exit...");
            while (ConsoleKey.Escape != Console.ReadKey(true).Key)
            {
                WC.Pattern.Singleton<WC.Pilot.EchoServer>.Instance.Print();
            }
            log.Info("-----------------------------------------------");
        }
    }
}
